package com.osmino.contacts.groups;

import android.view.MotionEvent;


public class Drag {
	
	public static final int NONE = 0;
	public static final int DRAG = 1;
	
	private int mState = 0;
	
	private DragListener mListener = new DragListener() {
		@Override
		public void onDrag(int state1, int state2, MotionEvent event) {
		}

		@Override
		public void onStateChanged(int newState) {
		}

		@Override
		public void onUp(MotionEvent event) {
		}
	};
	
	public void obtain(int state, MotionEvent event){
		mListener.onDrag(mState, state, event);
		mState = state;
	}
	
	public void setState(int state){
		mListener.onStateChanged(state);
		mState = state;
	}
	
	public int getState(){
		return mState;
	}
	
	public void setUp(MotionEvent event){
		mListener.onUp(event);
	}
	
	public void setListener(DragListener listener){
		mListener = listener;
	}
	
	public interface DragListener{
		public void onStateChanged(int newState);
		public void onDrag(int state1, int state2, MotionEvent event);
		public void onUp(MotionEvent event);
	}
}
